package com.yonyou.web.views;

import android.content.Context;
import android.os.Build;
import android.support.annotation.Nullable;
import android.support.annotation.RequiresApi;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.LinearLayout;

/**
 * Created by lxp on 2017/7/27.
 */

public abstract class BaseLinearLayout extends LinearLayout {
    public Context mContext;
    public View mRootView;

    public BaseLinearLayout(Context context) {
        super(context);
        mContext = context;
        inits();
    }

    public BaseLinearLayout(Context context, @Nullable AttributeSet attrs) {
        super(context, attrs);
        mContext = context;
        inits();
    }

    public BaseLinearLayout(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
        mContext = context;
        inits();
    }

    @RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
    public BaseLinearLayout(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
        super(context, attrs, defStyleAttr, defStyleRes);
        mContext = context;
        inits();
    }


    public void inits() {
        initViews();
        initDatas();
    }

    public abstract int getLayoutId();

    /**
     * 初始化组件
     */
    public abstract void initViews();

    /**
     * 初始化数据
     */
    protected abstract void initDatas();


}
